home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / portable / beep.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  1.5 KB  |  64 lines

  1. #define CURSES_LIBRARY    1
  2. #include <curses.h>
  3. #ifdef UNIX
  4. #include <defs.h>
  5. #include <term.h>
  6. #endif
  7. #undef beep
  8.  
  9. #ifdef PDCDEBUG
  10. char *rcsid_beep = "$Header: C:\CURSES\portable\RCS\beep.c 2.1 1993/06/18 20:19:33 MH Rel MH $";
  11. #endif
  12.  
  13.  
  14.  
  15.  
  16. /*man-start*********************************************************************
  17.  
  18.   beep()    - generate audio-visual alarm.
  19.  
  20.   X/Open Description:
  21.      This routine is used to signal the terminal user.  The beep()
  22.      function will sound the audible bell on the terminal, if possible
  23.      and if not, will flash the screen (visible bell), if possible.
  24.      The flash() function will flash the screen, and if that is not
  25.      possible, will sound the audible signal.  If neither signal is
  26.      possible, nothing will happen.  Nearly all terminals have an
  27.      audible signal (bell or beep), but only some can flash the screen.
  28.  
  29.   X/Open Return Value:
  30.      The beep() and flash() functions return OK on success and ERR on
  31.      error.
  32.  
  33.   X/Open Errors:
  34.      No errors are defined for this function.
  35.  
  36.   Portability:
  37.      PDCurses    int beep( void );
  38.      X/Open Dec '88    int beep( void );
  39.      BSD Curses    int beep( void );
  40.      SYS V Curses    int beep( void );
  41.  
  42. **man-end**********************************************************************/
  43.  
  44. int    beep(void)
  45. {
  46. #ifdef PDCDEBUG
  47.     if (trace_on) PDC_debug("beep() - called\n");
  48. #endif
  49.  
  50.     if (!_cursvar.audible)
  51.     {
  52.         flash();
  53.         return( ERR );        /* We try to flash instead...*/
  54.     }
  55.  
  56. #ifdef UNIX
  57.     if (bell != NULL)
  58.         putp(bell);
  59. #else
  60.     PDC_putctty( '\007', 0 );
  61. #endif
  62.     return( OK );
  63. }
  64.